$(function() {
	$( ".datepicker" ).datepicker({
    changeMonth: true,
    changeYear: true,
    dateFormat: "dd/mm/yy",
    showOn: "button",
    buttonImage: "/assets/jquery/calendar.gif",
    buttonImageOnly: true
	});
	
	$('.valor').number(true, 2);

	$("label.obrigatorio").prepend("<i class='icon-exclamation-sign'></i>");

	$(".number").keypress(function(event) {
		// keycodes para backspace, insert, delete, tab, setas direcionais...
		var allowed = [8,9,37,38,39,40,45,46];
		
		//keycodes para digitos: 48..57
		if (!((event.which >= 48 && event.which <= 57) || $.inArray(event.which, allowed) != -1)) {
			event.preventDefault();
		}
	});

	$("a.alternate").click(function(event) {
		var id_associado = $(this).attr("href");
		var associado = $(id_associado);

		$($(this).data("master")).fadeOut("fast");
		associado.fadeIn("fast");

		event.preventDefault();
	});
	
});

